package com.chen.dome8fileWriter;

import java.io.FileWriter;
import java.io.Writer;

public class filewriterDome1 {
    public static void main(String[] args) {
        try ( Writer fw=new FileWriter("D:\\学生成绩管理系统\\javaprojectmax\\d2_file-io\\src\\text.txt"))
        {
            fw.write("hello world");
            fw.write("\r\n");
            fw.write("陈世玉");
            fw.write("\r\n");
            //用字符流写入数据
            fw.write("chen",1,2);
            fw.write("\r\n");
            char[] chs="陈世玉Java".toCharArray();
            fw.write(chs);
            fw.write("\r\n");
            fw.write(chs,0,3);
//            fw.flush();
//            System.out.println("写入完毕");
//            fw.close();
        } catch (Exception e) {
           e.printStackTrace();
        }
    }
}
